package com.heima.user.controller.v1;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.model.user.pojos.ApUserFollow;
import com.heima.user.mapper.ApUserFollowMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/user_follow")
public class ApUserFollowController {

    @Autowired
    ApUserFollowMapper apUserFollowMapper;

    @GetMapping("/getUserFollow")
    public ApUserFollow getUserFollow(@RequestParam("loginUserID")Integer loginUserID,@RequestParam("authorUserID")Integer authorUserID){
        return apUserFollowMapper.selectOne(Wrappers.<ApUserFollow>lambdaQuery()
        .eq(ApUserFollow::getUserId,loginUserID)
        .eq(ApUserFollow::getFollowId,authorUserID));
    }

}
